package com.example.recyclerviewstudentmessage;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private RecyclerView rvMainStudent;
    private List<Student> list = new ArrayList();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        list.add(new Student("小明", 18, "移动203", "13556189134"));
        list.add(new Student("小红", 18, "移动203", "13425165116"));
        list.add(new Student("小江", 18, "移动203", "13656465484"));
        list.add(new Student("小李", 18, "移动203", "13746546465"));
        list.add(new Student("小陈", 18, "移动203", "13854565498"));
        list.add(new Student("小徐", 18, "移动203", "13246548489"));
        list.add(new Student("李华", 18, "移动203", "13345468949"));
        list.add(new Student("张三", 18, "移动203", "13548865411"));
        list.add(new Student("李四", 18, "移动203", "13484874968"));

        rvMainStudent.setLayoutManager(new LinearLayoutManager(this));
        rvMainStudent.setAdapter(new StudentRViewAdapter(list));
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        rvMainStudent = (RecyclerView) findViewById(R.id.rvMainStudent);
    }

}
